<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="__STATIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__STATIC__/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__STATIC__/admin/css/animate.min.css" rel="stylesheet">
    <link href="__STATIC__/admin/css/style.min.css?v=4.1.0" rel="stylesheet">
    <link href="__STATIC__/admin/js/plugins/bootstrap-tagsinput/bootstrap-tagsinput.css" rel="stylesheet">
    <link href="__STATIC__/admin/js/layui/css/layui.css"rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">

    <div class="row">
        <div class="col-sm-12">
            <div class="ibox-content p-xl">
                <div class="row">
                    <div class="col-sm-12 text-center">
<style>
    .top>tbody>tr>td:last-child{
        text-align:left;
        width: 88%;
    }
</style>
                        <table class="table invoice-total top" style="display: block; float: left;">
                            <tbody>
                            <tr>
                                <td><strong>订单号：</strong></td>
                                <input type="hidden" id="order_mun" name="order_mun" value="{$orderinfo[0]['order_mun']}">
                                <td >{$orderinfo[0]['order_mun']}</td>
                            </tr>
                            <tr>
                                <td><strong>联系人：</strong></td>
                                <td><input type="text" name="name" value="{$orderinfo[0]['name']|default=''}" style="border: none"></td>
                            </tr>
                            <tr>
                                <td><strong>电话：</strong></td>
                                <td><input type="text" name="phone"required value="{$orderinfo[0]['phone']|default=''}"style="border: none"></td>
                            </tr>
                            <tr>
                                <td><strong>订单时间：</strong></td>
                                <td>{$orderinfo[0]['addtime']|date="Y-m-d H:i:s",###}</td>
                            </tr>
                            <tr>
                                <td><strong>服务时间：</strong></td>
                                <td><input type="text" id="servcietime" name="servcietime"required value="{$orderinfo[0]['servcietime']|date='Y-m-d H:i:s',###}" style="border: none"></td>
                            </tr>
                            <tr>
                                <td><strong>收货地址：</strong></td>
                                <td><input type="text" name="addr" required value="{$orderinfo[0]['addr']|default=''}" style="border: none" style="width:100%";> </td>
                            </tr>
                            <tr>
                                <td><strong></strong></td>
                                <td><a href="javascript:;" onclick="editaddr()">立即修改</a></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>

                <div class="table-responsive m-t">
                    <table class="table invoice-table">
                        <thead>
                        <tr>
                            <th>商品名称</th>
                            <th>数量</th>
                            <th>单价</th>
                            <th>规格</th>
                            <th>总价</th>
                        </tr>
                        </thead>
                        <tbody>
                        {foreach $orderinfo as $v}
                            <tr>
                                <td>
                                    <div><strong style="margin-right: 10px">{$v.goods_name}</strong>
                                    </div>
                                </td>
                                <td>{$v.munber}</td>
                                <td>&yen;{$v.price}</td>
                                <td>{$v.shuxing_name}</td>

                                <td>&yen;
                                    {php}
                                        echo $v['munber'] * $v['price'];
                                    {/php}
                                </td>
                            </tr>
                        {/foreach}
                        </tbody>
                    </table>
                </div>
                <!-- /table-responsive -->
                <div class="table-responsive m-t">
                    <table class="table invoice-table">
                        <thead>
                        <tr>
                            <th>总费用</th>
                            <th>材料费</th>
                            <th>配件名称</th>
                            <th>成本</th>
                            <th>图片</th>
                            <th>备注</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>
                                &yen;{$peijian.total_price}
                            </td>
                            <td>&yen;{$peijian.cailiao_price}</td>
                            <td>{$peijian.cailiao_name}</td>
                            <td>&yen;{$peijian.chenben_price}</td>
                            <td>
                                {if !empty($peijian.imgs)}
                                   <?php  $imgs=explode(',',$peijian['imgs']);?>
                                    {foreach $imgs as $vv}
                                        {if !empty($vv)}
                                            <img src="{$vv}" width="80px" height="50px">
                                        {/if}
                                    {/foreach}
                                {/if}
                            </td>
                            <td>{$peijian.remake}</td>

                        </tr>
                        </tbody>
                    </table>
                </div>
                <div class="row">
                    <div class="col-sm-12 text-center">
                        <table class="table table-striped table-bordered table-hover dataTables-example dataTable" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
                            <thead>
                            <tr>
                                <td width="20%">操作人</td>
                                <td width="20%">操作时间</td>
                                <td width="20%">操作</td>
                                <td >操作操作说明</td>
                            </tr>
                            </thead>
                            <tbody>
                            {foreach $liucheng as $v}
                                <tr>
                                    <td>{$v['userid']}</td>
                                    <td >{$v['addtime']|date="Y-m-d H:i:s",###}</td>
                                    <td >{$v['type']}</td>
                                    <td >{$v['quxiao_remake']}</td>
                                </tr>
                            {/foreach}
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12 text-center">
                        <style>
                            .top>tbody>tr>td:last-child{
                                text-align:left;
                                width: 88%;
                            }
                        </style>
                        <table class="table invoice-total top" style="display: block; float: left;">
                            <tbody>
                            <tr>
                                <td><strong>评论等级：</strong></td>
                                <td >{$orderinfo[0]['hzc']==1?'好评':$orderinfo[0]['hzc']==2?'中评':$orderinfo[0]['hzc']==3?'差评':''}</td>
                            </tr>
                            <tr>
                                <td><strong>内容评论：</strong></td>
                                <td >{$orderinfo[0]['pinglun']|default=''}</td>
                            </tr>
                            <tr>
                                <td><strong>内容时间：</strong></td>
                                <td >{if condition="$orderinfo[0]['pinglun_time'] gt 0"}{$orderinfo[0]['pinglun_time']|date="Y-m-d H:i:s",###}{/if}</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="text-right">
                    {if condition="$orderinfo[0]['status'] gt 3"}
                        {if condition="$orderinfo[0]['shenhe'] eq 0"}
                        <a class="btn btn-primary" href="javascript:;" onclick="shenhe('{$orderinfo[0]['order_mun']}')">审核</a>
                        {else /}
                        <a class="btn btn-primary" href="javascript:;" onclick="">已审核</a>
                        {/if}
                        {if condition="$orderinfo[0]['duanxin'] eq 0"}
                        <a class="btn btn-primary" href="javascript:;" onclick="sendsms('{$orderinfo[0]['order_mun']}')">发送短信</a>
                        {else /}
                        <a class="btn btn-primary" href="javascript:;" onclick="">已发送</a>
                        {/if}
                    {/if}
                    {if condition="$orderinfo[0]['status'] eq 2"}
                    <a class="btn btn-primary" href="javascript:;" onclick="quxiao('{$orderinfo[0]['order_mun']}')">取消订单</a>
                    {/if}
                    <a class="btn btn-primary" href="javascript:;"  onclick="javascript:history.back(-1);">返回</a>

                </div>
            </div>
        </div>
    </div>
</div>
</div>
<script src="__STATIC__/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="__STATIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__STATIC__/admin/js/content.min.js?v=1.0.0"></script>
<script src="__STATIC__/admin/js/plugins/bootstrap-tagsinput/bootstrap-tagsinput.min.js"></script>
<script src="__STATIC__/admin/js/plugins/validate/jquery.validate.min.js"></script>
<script src="__STATIC__/admin/js/plugins/validate/messages_zh.min.js"></script>

<script src="__STATIC__/admin/js/plugins/layer/layer.min.js"></script>
<script src="__STATIC__/admin/laydate/laydate.js"></script>
<script src="__STATIC__/admin/js/layui/layui.js"></script>
<script src="__STATIC__/admin/js/jquery.form.js"></script>
    <script type="text/javascript">
        function quxiao(order_mun) {
            layer.confirm('确认取消订单？',{
                btn:['确认','再想想...']
            },function (index) {
                close(index)
                $.ajax({
                    url:'{:url("quxiao")}',
                    type:'post',
                    data:{order_mun:order_mun},
                    success:function (res) {
                        if (res.code == 1){
                            layer.msg(res.msg,{iocn:1,time:1000},function () {
                                window.location.href = res.data;
                            })
                        }else {
                            layer.msg(res.msg,{iocn:2,time:1000})
                        }
                    }
                })
            })
        }
        
        laydate.render({
            elem: '#servcietime',
            type: 'datetime',
            format:'yyyy-MM-dd HH:mm'
        });
    function sendsms(order_mun) {
        $.ajax({
            url:"{:url('sendSms')}",
            type:'post',
            data:{order_mun:order_mun},
            success:function (res) {
                if (res.code == 1){
                    layer.msg(res.msg,{iocn:1,time:1000},function () {
                        window.location.href = res.data;
                    })
                }else {
                    layer.msg(res.msg,{iocn:1,time:1000})
                }
            }
        })
    }
function editaddr() {
        layer.confirm('您要修改订单信息？',{
            btn:['确定','再想想...']
        },function (index) {
            close(index);
            var data = {
                order_mun:$('input[name="order_mun"]').val(),
                addr :$('input[name="addr"]').val(),
                name : $('input[name="name"]').val(),
                phone : $('input[name="phone"]').val(),
                servcietime : $('input[name="servcietime"]').val(),
            }

            $.ajax({
                url:"{:url('editaddr')}",
                type:'post',
                data:data,
                success:function (res) {console.log(res)
                    if (res.code == 1){
                        layer.msg(res.msg,{iocn:1,time:1000},function () {
                            window.location.href = res.data;
                        })
                    }else {
                        layer.msg(res.msg,{iocn:2,time:1000})
                    }
                }
            })
        })

}
    function shenhe(order_mun) {
        layer.confirm('确认审核吗?',{
            btn:['确定','再想想...']
        },function (index) {
            close(index);
            $.ajax({
                url:"{:url('shenhe')}",
                type:'post',
                data:{order_mun:order_mun},
                success:function (res) {
                    if (res.code == 1){
                        layer.msg(res.msg,{iocn:1,time:1000},function () {
                            window.location.href = res.data;
                        })
                    }else {
                        layer.msg(res.msg,{iocn:2,time:1000})
                    }
                }
            })
        })

    }
</script>
</body>
</html>